package com.zhongfl.crm.api.view;

import com.github.pagehelper.PageInfo;
import com.zhongfl.crm.model.LxProduct;
import com.zhongfl.crm.request.LxProductRequest;
import com.zhongfl.crm.service.LxProductService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.heptagram.core.common.rest.ResponseResult;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 向日葵
 * @Date 2018/9/20
 */
@RestController
@RequestMapping("/api/product")
public class LxProductApiController {

    @Resource
    private LxProductService lxProductService;

    @PostMapping("/list")
    public ResponseResult<PageInfo<LxProduct>> findProductList(@RequestBody LxProductRequest lxProductRequest){
        List<LxProduct> list = lxProductService.findProductList(lxProductRequest);
        PageInfo<LxProduct> products = new PageInfo<>(list);
        return new ResponseResult<>(products);
    }
}
